﻿@{
    <script src="~/js/jquery-1.11.1.js"></script>
    <link href="~/css/table.css" rel="stylesheet" />
    <script src="~/js/vue.js"></script>
}
<body>
    <div id="app">
        <form id="form1" role="form">
            <table width="100%">
                <tr>
                    <td>
                        <font color="black">
                            您正在做的业务是：人力资源--客户化设置--人力资源档案管理设置--职位设置--职位添加
                        </font>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <button type="button" v-on:click="add" class="BUTTON_STYLE1">提交</button>
                        <input type="button" value="返回" class="BUTTON_STYLE1"
                               onclick="history.back();">
                    </td>
                </tr>
            </table>
            <table width="100%" border="1" cellpadding=0 cellspacing=1
                   bordercolorlight=#848284 bordercolordark=#eeeeee
                   class="TABLE_STYLE1">
                <tr>
                    <td class="TD_STYLE1" width="19%">
                        职位分类编号
                    </td>
                    <td class="TD_STYLE2" width="81%">
                        <input type="text" class="INPUT_STYLE1" id="major_kind_id" v-model="major_kind_id" name="major_kind_id" placeholder="请输入职位分类编号" />
                    </td>
                </tr>
                <tr>
                    <td class="TD_STYLE1" width="19%">
                        职位分类名称
                    </td>
                    <td class="TD_STYLE2" width="81%">
                        <input type="text" class="INPUT_STYLE1" id="major_kind_name" v-model="major_kind_name" name="major_kind_name" placeholder="请输入职位分类名称" />
                    </td>
                </tr>
                <tr>
                    <td class="TD_STYLE1" width="19%">
                        职位编号
                    </td>
                    <td class="TD_STYLE2" width="81%">
                        <input type="text" class="INPUT_STYLE1" id="major_id" v-model="major_id" name="major_id" placeholder="请输入职位编号" />
                    </td>
                </tr>
                <tr>
                    <td class="TD_STYLE1" width="19%">
                        职位名称
                    </td>
                    <td class="TD_STYLE2" width="81%">
                        <input type="text" class="INPUT_STYLE1" id="major_name" v-model="major_name" name="major_name" placeholder="请输入职位名称" />
                    </td>
                </tr>
            </table>
        </form>
    </div>
</body>
<script type="text/javascript">
    var vm = new Vue({
        el: "#app",
        data: {
            major_kind_id: "",
            major_kind_name: "",
            major_id: "",
            major_name: ""
        },
        methods: {
            add: function () {
                var major_kind_id = $("#major_kind_id").val();
                var major_kind_name = $("#major_kind_name").val();
                var major_id = $("#major_id").val();
                var major_name = $("#major_name").val();
                if (major_kind_id == "") {
                    alert('请输入职位分类编号！');
                    return false;
                } else if (major_kind_name == "") {
                    alert('请输入职位分类名称！');
                    return false;
                } else if (major_id == "") {
                    alert('请输入职位编号！');
                    return false;
                } else if (major_name == "") {
                    alert('请输入职位名称！');
                    return false;
                }
                $.ajax({
                    url: "/client1/major_add",
                    type: "post",
                    data: $("#form1").serialize(),
                    success: function (msg) {
                        if (msg > 0) {
                            alert('增加成功');
                            location.href = "/client1/major";
                        }
                    }
                });
            }
        }
    });
</script>


